<?php


namespace app\api\controller;


use app\common\business\Goods as GoodsBis;
use app\common\business\Order;
use app\common\lib\Show;
class Index extends ApiBase
{
    /**
     * 首页轮播图
     * @return \think\response\Json
     */
    public function getRotationChart(){
        $result = (new GoodsBis())->getRotationChart();
        return Show::success($result);
    }

    /**
     * 首页推荐
     * @return \think\response\Json
     */
    public function categoryGoodsRecommend(){
        $categorys = [
            1,2,3,4,5
        ];
        $result = (new GoodsBis())->categoryGoodsRecommend($categorys);
        return Show::success($result);
    }

	/**
	 * 获取订单详情
	 */
    public function read(){
    	$id = input("param.id", "0", "trim");
    	if(empty($id)){
    		return Show::error("参数错误");
		}
    	$data = [
    		"user_id" => $this->userId,
			"order_id" => $id,
		];
    	$result = (new Order())->detail($data);
    	if(!$result){
    		return Show::error("订单获取失败");
		}
    	return Show::success($result);
	}
}
